<template>
  <svg aria-hidden="true" :style="{ width: props.width, height: props.height }">
    <use :href="symbolId" :fill="color" />
  </svg>
</template>

<script lang="ts" setup>
import { computed } from 'vue'
const props = defineProps({
  // xlink:href 属性值的前缀 "#icon-"
  prefix: {
    type: String,
    default: 'icon',
  },
  // svg图标的名字
  name: String,
  // svg 图标的颜色
  color: {
    type: String,
    default: '',
  },
  width: {
    type: String,
    default: '16px',
  },
  height: {
    type: String,
    default: '16px',
  },
})
const symbolId = computed(() => `#${props.prefix}-${props.name}`)
</script>
